package 力扣日常刷题.木22一月.第05天0113;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 帅小伙
 * @date 2022/1/13
 * @description
 */
public class Demo02位运算简单二进制手表 {

    class Solution {
        public List<String> readBinaryWatch(int turnedOn) {
            List<String> ans = new ArrayList<String>();

            // 枚举每一个时间
            for (int i = 0; i < 12; i++) {
                for (int j = 0; j < 60; j++) {
                    if(Integer.bitCount(i) +Integer.bitCount(j) == turnedOn) {
                        ans.add(i +":" +(j<10 ? "0" : "")+j);
                    }
                }
            }


            return ans;
        }
    }

}
